# 元组
tua = (1, 2, 3, 4, 5)
print(type(tua))

tua = (1,)
print(type(tua))
tua = (1, 2, 3)
print(type(tua))
print(tua[0])
name = 'zhansan'
age = 18
print('%s的年龄是：%d' % (name, age))
info = (name, age)
print('%s的年龄是：%d' % info)

# 字典
dic = {'name': 'zhansan', 'age': '18'}
print(type(dic))
# 不存在报错
print(dic['age'])
# 不存在 返回 None
print(dic.get('name'))
dic['name'] = 'lisi'
dic['age'] = '20'
print(dic)
dic['tel'] = '13573435634'
print(dic)
# 删除 del
del dic['tel']
print(dic)
# pop() 删除指定键值
dic.pop('age')
print(dic)
# 删除最后一个键值
dic.popitem()
print(dic)
# clear() 删除内容
dic.clear()
print(dic)
del dic

dic = {'name': 'zhangsan', 'age': 20, 'phone': '1354323524'}
# 字典长度
print(len(dic))
# 返回所有键名
print(dic.keys())
for i in dic:
    print(i)
# 返回所有字典值
print(dic.values())
for i in dic.values():
    print(i)
print(dic.items())
for i in dic.items():
    print(i, type(i))

# 集合 set
s1 = {1, 2, 3}
print(s1, type(s1))
# 定义空集合
s1 = set()
print(type(s1))

s1 = {'a', 'b', 'c', 'd', 'e', 'f'}
print(s1)
s2 = {1, 2, 3, 4, 5}
print(s2)
# add 添加值
s1.add('g')
print(s1)
# update() 拆分放入集合
s2.update((4, 6, 7, 8, 9))
print(s2)
# remove 删除元素
s2.remove(2)
print(s2)
# pop() 删除 hash表排序第一个元素
s2.pop()
print(s2)
# discard
s2.discard(5)
print(s2)

# 交集 和 并集
a = {1, 2, 3, 3, 4, 5}
b = {3, 4, 5, 6, 7, 8}
print(a & b)
print(a | b)

